<template>
    <div class="e-table">
        <el-table
            :data="tableData"
            border
            style="width: 100%"
            @cell-mouse-enter="cellMouseEnter"
            @cell-mouse-leave="cellMouseLeave"
            :cell-class-name="cellClsNm"
            @selection-change="selectionChange"
            :max-height="$store.state.tableHeight"
            ref="table"
            v-sortTable="{ tableData: tableData, _this: this, ref: 'table' }"
        >
            <el-table-column show-overflow-tooltip width="55" type="selection"> </el-table-column>
            <el-table-column show-overflow-tooltip type="index" label="序号" width="50">
            </el-table-column>
            <el-table-column show-overflow-tooltip prop="documentNo" label="文件编号">
            </el-table-column>
            <el-table-column show-overflow-tooltip prop="name" label="公文文件名称">
            </el-table-column>
            <el-table-column show-overflow-tooltip prop="oaCreatTime" label="备案时间" width="170">
            </el-table-column>
            <el-table-column show-overflow-tooltip prop="createUser" label="备案人" width="100">
            </el-table-column>
            <el-table-column show-overflow-tooltip prop="gmtCreate" label="上传时间" width="110">
            </el-table-column>
        </el-table>
        <!-- <ComPagination
            :total="pagination.total"
            :pageSize.sync="pagination.pageSize"
            :currentPage.sync="pagination.currentPage"
            @currentChange="documentListByEntity"
            @sizeChange="documentListByEntity"
        /> -->
    </div>
</template>
<script>
// import ComPagination from '@/components/pagination/pagination.vue'
// import tenderRequest from '@/api/tender/tender.js'
import applyRequest from '@/api/tender/apply.js'
// import commonRequest from '@/api/tender/common.js'

export default {
    props: {
        // 审核状态
        auditState: {
            type: Object,
            default: function () {
                return {}
            }
        }
    },
    data () {
        return {
            tableData: [],
            selection: []
        }
    },
    computed: {
        tenderId () {
            return this.$route.query.tenderId || this.$route.query.billid
        }
    },
    components: {
        // ComPagination
    },
    created () {
        this.documentListByEntity()
    },
    methods: {
        // 父组件有调用
        delFiles () {
            const ids = this.selection.map(value => value.recordId).join(',')
            applyRequest.documentDelete({ ids }).then(() => {
                const callBack = () => {
                    this.documentListByEntity()
                }
                this.clientPop('suc', '删除成功', callBack)
            })
        },
        downFile () {
            window.open(this.selection[0].filePath)
            // commonRequest.downBlob(this.selection[0].filePath).then(res => {
            //     console.log(res)
            // })
        },
        selectionChange (selection) {
            this.selection = selection
        },
        documentListByEntity () {
            applyRequest
                .documentListByEntity({
                    billId: this.tenderId,
                    limit: 20,
                    page: 1
                })
                .then(res => {
                    this.tableData = res.list
                    console.log(this.tableData)
                })
        }
    }
}
</script>
<style lang="scss" scoped></style>
